#! /usr/bin/env python3
# -*- encoding:utf-8 -*-
__param__ = 1
__notfount__ = 2
__business__ = 3
__permission__ = 4
__other__ = 5


class APIException(Exception):
    def __init__(self, error, errorCode=__other__, message='', data=''):
        super(APIException, self).__init__(message)
        self.error = error
        self.errorCode = errorCode
        self.data = data
        self.message = message


class APIParamException(APIException):
    def __init__(self,
                 error='value:invalid',
                 errorCode=__param__,
                 message='',
                 data=''):
        return super(APIParamException, self).__init__(error, errorCode,
                                                       message, data)


class APINotFoundException(APIException):
    def __init__(self,
                 error='value:notfound',
                 errorCode=__notfount__,
                 message='',
                 data=''):
        return super(APINotFoundException, self).__init__(
            error, errorCode, message, data)


class APIPermissionException(APIException):
    def __init__(self,
                 error='permission:denied',
                 errorCode=__permission__,
                 message='',
                 data=''):
        return super(APIPermissionException, self).__init__(
            error, errorCode, message, data)
